home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.alaska-software.com
/
2014.06.ftp.alaska-software.com.tar
/
ftp.alaska-software.com
/
3pp
/
mxsetup.old
/
{app}
/
PbMenBar.prg
< prev
next >
Wrap
Text File
|
2001-09-30
|
8KB
|
261 lines
//////////////////////////////////////////////////////////////////////
//
// PbMenBar.PRG
//
// Copyright:
// Maniacc Software Inc., (c) 2000. All rights reserved.
//
// Contents:
// PushButtonMenu Class
//
// Created 12/24/2000
//
//////////////////////////////////////////////////////////////////////
#include "Xbp.ch"
#include "Appevent.ch"
#include "Gra.ch"
#include "Mx.ch"
#include "Common.ch"
#include "Dll.ch"
*******************************************************************
* ( MxPbMenuBar ) CLASS DEFINITION
*******************************************************************
CLASS MxPbMenuBar FROM XbpStatic
EXPORTED:
VAR aItems
VAR nHeight, type
VAR lDefaults
METHOD init, create, addItem
ENDCLASS
*******************************************************************
* ( MxPbMenuBar ) METHOD init
*******************************************************************
METHOD MxPbMenuBar:init()
::xbpStatic:init()
::aItems := {}
::nHeight := 32
::type := MX_RECESSED
::lDefaults := .F.
RETURN self
*******************************************************************
* ( MxPbMenuBar ) METHOD create
*******************************************************************
METHOD MxPbMenuBar:create()
LOCAL oXbp
LOCAL aPos := setAppWindow():drawingArea:currentPos()
LOCAL aSize := setAppWindow():drawingArea:currentSize()
LOCAL i, j, nItems := len(::aItems)
setAppWindow():drawingArea:setSize({aSize[1],aSize[2]-::nHeight})
aPos := {aPos[1],aSize[2]-::nHeight}
aSize := {aSize[1],::nHeight}
if ::type==MX_RAISED
::XbpStatic:type := XBPSTATIC_TYPE_RAISEDBOX
elseif ::type==MX_RECESSED
::XbpStatic:type := XBPSTATIC_TYPE_RECESSEDBOX
elseif ::type==MX_FLAT
::XbpStatic:type := XBPSTATIC_TYPE_TEXT
else
::XbpStatic:type := XBPSTATIC_TYPE_TEXT
endif
::XbpStatic:create( setAppWindow(), , aPos, aSize )
::cargo := {}
if ::lDefaults
if aSize[1]>600
::addItem("VLine",{ ::XbpStatic,,{aSize[1]-354,4},{3,aSize[2]-8}})
::addItem("MXPB",{ ::XbpStatic,,{aSize[1]-349,3},{40,40},,,MX_FLYOVER,{"",{0,0},{0,0},""},{ICON_CLIPBOARD,{5,5},{25,32},1}},{||runshell( "","Clipbrd.exe",.T.),setAppWindow():show()} )
::addItem("MXPB",{ ::XbpStatic,,{aSize[1]-307,3},{40,40},,,MX_FLYOVER,{"",{0,0},{0,0},""},{ICON_OPENFILE,{5,5},{32,32},1}},{||MxFileOpen(,.T.)} )
::addItem("MXPB",{ ::XbpStatic,,{aSize[1]-265,3},{40,40},,,MX_FLYOVER,{"",{0,0},{0,0},""},{ICON_PRINTER,{5,5},{32,32},1}},{||setAppWindow():disable(),MxListProg(),setAppWindow():enable(),setAppFocus(setAppWindow())} )
endif
::addItem("VLine",{ ::XbpStatic,,{aSize[1]-220,4},{3,aSize[2]-8}})
::addItem("MXPB",{ ::XbpStatic,,{aSize[1]-213,3},{32,40},,,MX_FLYOVER,{"",{0,0},{0,0},""},{ICON_CALCULATOR,{5,5},{28,32},1}},{||runshell( "","Calc.exe",.T.)} )
::addItem("VLine",{ ::XbpStatic,,{aSize[1]-177,4},{3,aSize[2]-8}})
::addItem("SLE",{ ::XbpStatic,,{aSize[1]-170,24},{165,20},,,{" Company: "+"Maniacc Software",,"9.Arial Bold"}} )
::addItem("SLE",{ ::XbpStatic,,{aSize[1]-170,4},{165,20},,,{" User: "+"Demonstration",,"9.Arial Bold"}} )
endif
if nItems>0
for i := 1 to nItems
do while len(::aItems[i])<12
aAdd(::aItems[i],Nil)
enddo
::addItem( ::aItems[i,1],;
::aItems[i,2],;
::aItems[i,3],;
::aItems[i,4],;
::aItems[i,5],;
::aItems[i,6],;
::aItems[i,7],;
::aItems[i,8],;
::aItems[i,9],;
::aItems[i,10],;
::aItems[i,11],;
::aItems[i,12] )
aAdd(::XbpStatic:cargo,::aItems[i,8])
next i
endif
::resize := { |aOldSize,aNewSize,oObj| ::XbpStatic:setSize({aNewSize[1],::nHeight}),::show() }
RETURN self
*******************************************************************
* ( MxPbMenuBar ) METHOD addItem
*******************************************************************
* Add an Item to the MxPbMenuBar
* Parameters:
* cType: "Pb", "MxPb", "Txt", "VLine", "HLine", "Sle", "Cb"
* aArray: Calling Parameters for "Wrapper depending on cType
* bBlock: Code Block to be executed
*******************************************************************
METHOD MxPbMenuBar:addItem( cType,;
aArray,;
bBlock )
// Note: aArray should contain the calling Parameters
// for the wrapper being used.
LOCAL aMenArray
LOCAL oOwner := ::XbpStatic, oXbp
LOCAL i, nCapHt := 40
do while len(aArray)<9
aAdd(aArray,Nil)
enddo
DEFAULT cType to "PB"
DEFAULT bBlock to { || Nil }
if valtype(bBlock)=="B"
bBlock := bBlock
elseif valtype(bBlock)=="A"
i := len(::XbpStatic:childList())+1
bBlock := { |u1,u2,oBtn| popMenu(oBtn,::XbpStatic:cargo[i]) }
endif
if upper(cType)=="PB".or.upper(cType)=="MXPB"
oXbp := MxPshBtn( aArray[1],aArray[2],aArray[3],aArray[4],aArray[5],aArray[6],aArray[7],aArray[8],aArray[9] )
oXbp:activate := bBlock
oXbp:helpLink := ToolHelpLabel():new()
oXbp:cargo := "PBMENU"+alltrim(str(len(::XbpStatic:childList())))
elseif upper(cType)=="TXT"
oXbp := MxText( aArray[1],aArray[2],aArray[3],aArray[4],aArray[5],aArray[6],aArray[7] )
elseif upper(cType)=="VLINE"
oXbp := MxVline(aArray[1],aArray[2],aArray[3],aArray[4],aArray[5],aArray[6])
elseif upper(cType)=="HLINE"
oXbp := MxHline(aArray[1],aArray[2],aArray[3],aArray[4],aArray[5],aArray[6])
elseif upper(cType)=="SLE"
oXbp := MxSLE( aArray[1],aArray[2],aArray[3],aArray[4],aArray[5],aArray[6],aArray[7] )
oXbp:disable()
oXbp:helpLink := ToolHelpLabel():new()
oXbp:cargo := "PBMENU"+alltrim(str(len(::XbpStatic:childList())))
endif
RETURN oXbp
*******************************************************************
* FUNCTION MxSLE() - Wrapper for SLE Class
*******************************************************************
FUNCTION MxSLE( oParent, oOwner, aPos, aSize, aPresParam, lVisible, aCaption )
// Notes: aCaption = { cCaption, align, CompoundName }
LOCAL oXbp
oXbp := XbpSLE():new()
if !empty(aCaption)
iif(!empty(aCaption[2]),oXbp:align:=aCaption[2],Nil)
iif(!empty(aCaption[3]),oXbp:setFontCompoundName(aCaption[3]),Nil)
endif
oXbp:create( oParent, oOwner, aPos, aSize, aPresParam, lVisible )
if !empty(aCaption)
oXbp:setdata(aCaption[1])
endif
RETURN oXbp
*******************************************************************
* FUNCTION MxText() - Wrapper for Text
*******************************************************************
FUNCTION MxText( oParent, oOwner, aPos, aSize, aPresParam, lVisible, aCaption )
// Notes: aCaption = { cCaption, options, CompoundName }
LOCAL oXbp
oXbp := XbpStatic():new()
if !empty(aCaption)
iif(!empty(aCaption[1]),oXbp:caption:=aCaption[1],Nil)
iif(!empty(aCaption[2]),oXbp:options:=aCaption[2],Nil)
iif(!empty(aCaption[3]),oXbp:setFontCompoundName(aCaption[3]),Nil)
endif
oXbp:create( oParent, oOwner, aPos, aSize, aPresParam, lVisible )
RETURN oXbp
*******************************************************************
* FUNCTION MxVline() - Create a Recessed Vertical Line
*******************************************************************
FUNCTION MxVline( oParent, oOwner, aPos, aSize, aPresParam, lVisible )
LOCAL oXbp
oXbp := MxStatic():new()
oXbp:type := XBPSTATIC_TYPE_RECESSEDRECT
oXbp:create( oParent, oOwner, aPos, aSize, aPresParam, lVisible )
RETURN oXbp
*******************************************************************
* FUNCTION MxHline() - Create a Recessed Vertical Line
*******************************************************************
FUNCTION MxHline( oParent, oOwner, aPos, aSize, aPresParam, lVisible )
LOCAL oXbp
oXbp := MxStatic():new()
oXbp:type := XBPSTATIC_TYPE_RECESSEDRECT
oXbp:create( oParent, oOwner, aPos, aSize, aPresParam, lVisible )
RETURN oXbp